#ifndef ROBOT_H_
#define ROBOT_H_

#include <cv.h>
#include "stdio.h"
class nxColor;
#define PI 3.14159265
#define ANGLE_RAD 0
#define ANGLE_DEGREES 1
 
class Robot
{
	private:
		nxColor* baseColor;
		nxColor* robotColor;
		int minDist;
		int maxDist;
		int minArea;
		int maxArea;
		char* name;
		CvPoint center;
		CvPoint baseColorPos;
		CvPoint robotColorPos;
		double orientation;
	
	public:
	
		Robot(char* name,nxColor* baseColor, nxColor* robotColor){
			this->baseColor = baseColor;
			this->robotColor = robotColor;
			this->name = new char[20];
			sprintf(this->name,"%s",name);
			
			minDist=0;
			maxDist=0;
			
			minArea=0;
			maxArea=0;
			
			
		}
		~Robot()
		{
			delete name;
		}
		inline void setBaseColor(nxColor* baseColor){ this->baseColor = baseColor;}
		inline void setRobotColor(nxColor* robotColor){ this->robotColor = robotColor;}
		inline void setMinDist(int minDist){ this->minDist = minDist;}
		inline void setMaxDist(int maxDist){ this->maxDist = maxDist;}
		
		inline void setMinArea(int minArea){ this->minArea = minArea;}
		inline void setMaxArea(int maxArea){ this->maxArea = maxArea;}
		
		inline void setName(char* name){ sprintf(this->name,"%s",name);}
		//inline void setCenter(CvPoint center){ this->center = center;}
		inline void setBaseColorPos(CvPoint baseColorPos){ this->baseColorPos = baseColorPos;}
		inline void setRobotColorPos(CvPoint robotColorPos){ this->robotColorPos = robotColorPos;}
		//inline void setOrientation(double orientation){this->orientation = orientation;}
		
		inline nxColor* getBaseColor(){ return this->baseColor;}
		inline nxColor* getRobotColor(){ return this->robotColor;}
		inline int getMinDist(){ return this->minDist;}
		inline int getMaxDist(){ return this->maxDist;}
		
		inline int getMinArea(){ return this->minArea;}
		inline int getMaxArea(){ return this->maxArea;}
				
		inline char* getName(){ return this->name;}
		inline CvPoint getCenter(){
	
			center = cvPoint((int)(robotColorPos.x+baseColorPos.x)/2,(int)(robotColorPos.y+baseColorPos.y)/2);
    		return this->center;
		}
		
		inline CvPoint getBaseColorPos(){ return this->baseColorPos;}
		inline CvPoint getRobotColorPos(){ return this->robotColorPos;}
		inline double getOrientation(int type){ 
			
			orientation = atan2((baseColorPos.y - robotColorPos.y) , (baseColorPos.x - robotColorPos.x));
			switch(type)
			{
				case ANGLE_RAD:
					return this->orientation;
				break;
				case ANGLE_DEGREES:
					return 180 * orientation / PI;
					
				break;
				
			
			}
			}
		
	

};
#endif /*ROBOT_H_*/
